using System.Windows.Input;
using Avalonia;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;

namespace AvaloniaUI.Modal.Demo.ViewModels
{
    /// <summary>
    /// 输入对话框ViewModel
    /// </summary>
    public partial class InputDialogViewModel : ViewModelBase
    {
        /// <summary>
        /// 标题
        /// </summary>
        [ObservableProperty]
        private string _title = "输入";

        /// <summary>
        /// 提示文本
        /// </summary>
        [ObservableProperty]
        private string _prompt = string.Empty;

        /// <summary>
        /// 输入文本
        /// </summary>
        [ObservableProperty]
        private string _input = string.Empty;

        /// <summary>
        /// 确认按钮文本
        /// </summary>
        [ObservableProperty]
        private string _okText = "确定";

        /// <summary>
        /// 取消按钮文本
        /// </summary>
        [ObservableProperty]
        private string _cancelText = "取消";

        /// <summary>
        /// 确认命令
        /// </summary>
        [RelayCommand]
        private void Ok()
        {
            Application.Current?.GetModalService().CloseDialog(Input);
        }

        /// <summary>
        /// 取消命令
        /// </summary>
        [RelayCommand]
        private void Cancel()
        {
            Application.Current?.GetModalService().CloseDialog(null);
        }
    }
}